import java.util.LinkedList;

public class Main {
    public static void main(String[] args) {
        LinkedList<Integer> stack = new LinkedList<>();
        stack.push(1);
        stack.push(2);
        stack.push(3);
        System.out.println(stack.pop());// 3
        System.out.println(stack.peek());// 2
        System.out.println(stack.peek());// 2
    }
}